
package {
	import flash.display.Sprite;
	import flash.text.AntiAliasType;
	import flash.text.TextField;
	import flash.text.TextFormat;	

	/**
	 * @author Christian Rauh
	 */
	public class StepCounter extends Sprite {

		protected var tf : TextField;
		protected var step : Number;
		protected var total : Number;

		public function StepCounter(total : Number) {
        	
			super();
        	
			this.total = total;
        	
			tf = new TextField();
			tf.embedFonts = true;
			tf.selectable = false;
			tf.mouseEnabled = false;
			tf.antiAliasType = AntiAliasType.ADVANCED;
			tf.defaultTextFormat = new TextFormat(Main.FONT, 12, 0x55ff55);
			tf.alpha = .6;
			addChild(tf);
            
            step = 0;
			updateCounter();
		}

		public function updateCounter() : void {
			tf.text = step + " / " + total;
		}
		
		public function increment():void {
			step++;
			updateCounter();
		}
	}
}
